<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
 * Validation helper class.
 *
 */
class text extends text_Core {

    /*
        change html to text
    */
    public static function strip_html($text) {
        $search = array('@<script[^>]*?>.*?</script>@is',  // Strip out javascript
                       '@<style[^>]*?>.*?</style>@is',    // Strip style tags properly
                       '@<![\s\S]*?--[ \t\n\r]*>@is',    // Strip multi-line comments including CDATA
                       '@<[\/\!]*?[^<>]*?>@is',            // Strip out HTML tags
                       '@<[^>]*?>@is',                             // other content in < >
                       '@&nbsp;@is',                          // Strip space
                       '@[(\xc2\xa0)|\s]+/@is',                             // change wrap or break space
        );
        $replace = array('', '', '', '', '', ' ', '');
        $text = preg_replace($search, $replace, $text);
        $text = strip_tags($text);
//        $text = str_replace("\n", '', $text);
        $text = trim($text);
        return $text;
    }
}
